package hhm.ssm.service.impl;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import hhm.ssm.mybatis.dao.UsersMapper;
import hhm.ssm.mybatis.pojo.Users;
import hhm.ssm.service.IUsersService;

@Service

public class UsersService implements IUsersService {
	@Autowired
	private UsersMapper usersMapper;

	@Transactional
	public Users exchange(int userId) {

		for (int i = 0; i < 3; i++) {
			Users users = new Users();

			users.setUserName(i + "");
			if (i == 2) {

				Integer.parseInt("ww");

			}

			usersMapper.insert(users);

		}

		return this.usersMapper.selectByPrimaryKey(userId);
	}

}
